package com.jade.framework.web.security;

import javax.servlet.http.HttpServletRequest;

import com.jade.framework.base.security.ActionPermission;

/**
 * HttpServletRequest中的角色权限。
 *
 * @author Daisy
 * @version 1.0 14-10-7 下午11:43
 */
public class RolePermission  extends ActionPermission
{
    public RolePermission(String name)
    {
        super(name);
    }

    @Override
    public void checkGuard(Object obj)   throws SecurityException
    {
        if (!((HttpServletRequest) obj).isUserInRole(getName())) {
            throw new SecurityException("Permission deny:" + getName());
        }
    }
}
